package ACWing;

import java.util.Scanner;

/**
 * @author ShadowLim
 * @create 2022-03-21-19:44
 */
public class 数圈圈 {
    static int N = 20;
    static int[] arr = {1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0};    // 0 ~ F各个数字的圈数
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ret = 0;
        if (n == 0) {
            ret = 1;
        }
        while (n != 0)
        {
            int temp = n & 15;    // 逢16进1
            ret += arr[temp];
            n >>= 4;
        }
        System.out.println(ret);
    }
}
